package mytest.leetcode;

import java.util.HashMap;

public class Hot1 {

    public static void main(String[] args) {
        int[] nums = {3, 2, 4, 15};
        int[] res = new int[0];
        int target = 6;
        HashMap<Integer, Integer> hashMap = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            if (hashMap.containsKey(target - nums[i])) {
                res = new int[]{hashMap.get(target - nums[i]), i};
            }
            hashMap.put(nums[i], i);
        }
        for (int i = 0; i < res.length; i++) {
            System.out.println(res[i]);
        }
    }

}
